package com.zx.crowdfunding.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * SpringMVC配置类
 * 
 * @author 郑雪
 * @date 2021-12-31
 */
@Configuration
public class CrowdFundingWebMvcConfig implements WebMvcConfigurer {

	/**
	 * 直接把请求地址和视图名称关联起来，不必写handler方法了
	 */
	public void addViewControllers(ViewControllerRegistry registry) {
		
		// 浏览器访问的地址
		String urlPath = "/auth/member/to/register/page";
		
		// 目标视图的名称
		String viewName = "member-register";
		
		// 添加view-controller
		registry.addViewController(urlPath).setViewName(viewName);
		registry.addViewController("/auth/member/to/login/page").setViewName("member-login");
		registry.addViewController("/auth/member/to/center/page").setViewName("member-center");
		registry.addViewController("/member/my/crowd").setViewName("member-crowd");
	}

}
